motion controller: add details to signals
authorMatthias Clasen <mclasen@redhat.com>
Wed, 6 Mar 2019 19:56:46 +0000 (14:56 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 17 Mar 2019 03:03:41 +0000 (23:03 -0400)
The ::enter and ::leave signals get emitted up and down the
connecting path between the old an the new pointer location.

The signals are less useful if you can't find out where along
the path you are. That is what crossing mode and detail are
about, so add those to the signals.

gtk/gtkeventcontrollermotion.c

index f1d0d33a77c2fd468c273a06fa7e69ff81276953..5f40e94adee5b79a36852d1b166a7b4cb6b881c9 100644 (file)
@@ -67,16 +67,27 @@ gtk_event_controller_motion_handle_event (GtkEventController *controller,
   if (type == GDK_ENTER_NOTIFY)
     {
       double x, y;
+      GdkCrossingMode mode;
+      GdkNotifyType detail;
+
       gdk_event_get_coords (event, &x, &y);
-      g_signal_emit (controller, signals[ENTER], 0, x, y);
+      gdk_event_get_crossing_mode (event, &mode);
+      gdk_event_get_crossing_detail (event, &detail);
+      g_signal_emit (controller, signals[ENTER], 0, x, y, mode, detail);
     }
   else if (type == GDK_LEAVE_NOTIFY)
     {
-      g_signal_emit (controller, signals[LEAVE], 0);
+      GdkCrossingMode mode;
+      GdkNotifyType detail;
+
+      gdk_event_get_crossing_mode (event, &mode);
+      gdk_event_get_crossing_detail (event, &detail);
+      g_signal_emit (controller, signals[LEAVE], 0, mode, detail);
     }
   else if (type == GDK_MOTION_NOTIFY)
     {
       double x, y;
+
       gdk_event_get_coords (event, &x, &y);
       g_signal_emit (controller, signals[MOTION], 0, x, y);
     }
@@ -107,7 +118,12 @@ gtk_event_controller_motion_class_init (GtkEventControllerMotionClass *klass)
                   G_SIGNAL_RUN_FIRST,
                   0, NULL, NULL,
                   NULL,
-                  G_TYPE_NONE, 2, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
+                  G_TYPE_NONE,
+                  4,
+                  G_TYPE_DOUBLE,
+                  G_TYPE_DOUBLE,
+                  GDK_TYPE_CROSSING_MODE,
+                  GDK_TYPE_NOTIFY_TYPE);
 
   /**
    * GtkEventControllerMotion::leave:
@@ -121,7 +137,10 @@ gtk_event_controller_motion_class_init (GtkEventControllerMotionClass *klass)
                   G_SIGNAL_RUN_FIRST,
                   0, NULL, NULL,
                  NULL,
-                  G_TYPE_NONE, 0);
+                  G_TYPE_NONE,
+                  2,
+                  GDK_TYPE_CROSSING_MODE,
+                  GDK_TYPE_NOTIFY_TYPE);
 
   /**
    * GtkEventControllerMotion::motion: